'''
Created on Sat Jan 23 14:06:16 2021

Auther:ZXY
'''
import json

#本文档将包括两种存储和读取数据的方法

name = input('Please input your name:')

'''
以下为方法一
将使用Python的write和read语句
'''
filename1 = 'name.txt'

with open(filename1,'w') as file1:
	file1.write(name)

with open(filename1) as way1:
	name1 = way1.read()

print('Hello,%s!This is the first way!'%(name1))

'''
以下为方法二
将使用json模块的json.dump()和json.load()
可能在其他文件中更具有传递性
'''
filename2 = 'name.json'
with open(filename2,'w') as file2:
	json.dump(name,file2)

with open(filename2) as way2:
	name2 = json.load(way2)
print('Hello,%s!This is the second way!'%(name2.title()))